package com.wxw.BaseLibrary.component;

/**
 * Created by david on 2014-06-05.
 */
public class DataGridViewHead extends DataGridViewRow {

    public DataGridViewHead(DataGridView parent) {
        super(parent);
    }

    @Override
    public DataGridHeadCell getCell(int index) {
        if (_rowData == null || _rowData.size()<=0 || index<0 || index>=_rowData.size()) {
            return null;
        }
        return (DataGridHeadCell)_rowData.get(index);
    }

    @Override
    public void addCell(DataGridCell cell) {
        if (_rowData.contains(cell)) {
            return;
        }
        _rowData.add(cell);
    }

    @Override
    public int size() {
        return _rowData.size();
    }

    public void addCell(int col, String text){
        DataGridHeadCell cell = new DataGridHeadCell(this, col, text);
        _rowData.add(cell);
    }
}
